﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CIT.WMS.RM.Bll;
using CIT.WMS.Product.Bll;

namespace CIT.WMS.RM
{
    public partial class FrmWaitRemark : Form
    {
        public FrmWaitRemark()
        {
            InitializeComponent();
        }

        private void FrmRMOut_Load(object sender, EventArgs e)
        {
            InitFrm();
            txtWaitRemark.Focus();
        }

        /// <summary>
        /// 单号输入事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtBillNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                string wait = txtWaitRemark.Text;
                GetInfo(wait);
            }
        }

        /// <summary>
        /// 输入单号
        /// </summary>
        private void GetInfo(string wait)
        {
            try
            {
                var sql = @"select a.BillNo,ltrim(b.PartNumber) PartNumber,b.PlanQty from wms_T_InStockRM a inner join wms_T_InStockRMRows b 
on a.BillNo=b.BillNo where a.Status not in (6,9) and b.WaitRemark='{0}'";
                sql = string.Format(sql, wait);
                var dt = Utils.NMS.GetDataTable(sql);
                dgList.DataSource = dt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

        /// <summary>
        /// 初始化画面
        /// </summary>
        private void InitFrm()
        {
            //dgList.DataSource = null;
            txtWaitRemark.Focus();
        }
        //END
    }
}